﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Teigha.Core;

namespace Teigha.TD
{
	public class OdDbRevolvedSurface : OdDbSurface
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbRevolvedSurface(IntPtr cPtr, bool cMemoryOwn) : base(TD_DbPINVOKE.OdDbRevolvedSurface_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbRevolvedSurface obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbRevolvedSurface()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							TD_DbPINVOKE.delete_OdDbRevolvedSurface(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdDbRevolvedSurface cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbRevolvedSurface_cast(OdRxObject.getCPtr(pObj));
			OdDbRevolvedSurface result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbRevolvedSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbRevolvedSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbRevolvedSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbRevolvedSurface_desc(), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbRevolvedSurface_isA(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbRevolvedSurface_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdDbRevolvedSurface createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = TD_DbPINVOKE.OdDbRevolvedSurface_createObject();
			OdDbRevolvedSurface result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdDbRevolvedSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdDbRevolvedSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdDbRevolvedSurface)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createRevolvedSurface(OdDbEntity pRevEnt, OdGePoint3d axisPnt, OdGeVector3d axisDir, double revAngle, double startAngle, OdDbRevolveOptions revolveOptions, OdStreamBuf pSat)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRevolvedSurface_createRevolvedSurface__SWIG_0(this.swigCPtr, OdDbEntity.getCPtr(pRevEnt), OdGePoint3d.getCPtr(axisPnt), OdGeVector3d.getCPtr(axisDir), revAngle, startAngle, OdDbRevolveOptions.getCPtr(revolveOptions), OdStreamBuf.getCPtr(pSat));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdResult createRevolvedSurface(OdDbEntity pRevEnt, OdGePoint3d axisPnt, OdGeVector3d axisDir, double revAngle, double startAngle, OdDbRevolveOptions revolveOptions)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRevolvedSurface_createRevolvedSurface__SWIG_1(this.swigCPtr, OdDbEntity.getCPtr(pRevEnt), OdGePoint3d.getCPtr(axisPnt), OdGeVector3d.getCPtr(axisDir), revAngle, startAngle, OdDbRevolveOptions.getCPtr(revolveOptions));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdDbEntity getRevolveEntity()
		{
			OdDbEntity result = (OdDbEntity)Teigha.Core.Helpers.odrxCreateObjectInternal(TD_DbPINVOKE.OdDbRevolvedSurface_getRevolveEntity(this.swigCPtr), false);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdGePoint3d getAxisPnt()
		{
			OdGePoint3d result = new OdGePoint3d(TD_DbPINVOKE.OdDbRevolvedSurface_getAxisPnt(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setAxisPnt(OdGePoint3d pnt)
		{
			TD_DbPINVOKE.OdDbRevolvedSurface_setAxisPnt(this.swigCPtr, OdGePoint3d.getCPtr(pnt));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGeVector3d getAxisVec()
		{
			OdGeVector3d result = new OdGeVector3d(TD_DbPINVOKE.OdDbRevolvedSurface_getAxisVec(this.swigCPtr), true);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setAxisVec(OdGeVector3d vec)
		{
			TD_DbPINVOKE.OdDbRevolvedSurface_setAxisVec(this.swigCPtr, OdGeVector3d.getCPtr(vec));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double getRevolveAngle()
		{
			double result = TD_DbPINVOKE.OdDbRevolvedSurface_getRevolveAngle(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setRevolveAngle(double ang)
		{
			TD_DbPINVOKE.OdDbRevolvedSurface_setRevolveAngle(this.swigCPtr, ang);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public double getStartAngle()
		{
			double result = TD_DbPINVOKE.OdDbRevolvedSurface_getStartAngle(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void setStartAngle(double startAng)
		{
			TD_DbPINVOKE.OdDbRevolvedSurface_setStartAngle(this.swigCPtr, startAng);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void getRevolveOptions(OdDbRevolveOptions revolveOptions)
		{
			TD_DbPINVOKE.OdDbRevolvedSurface_getRevolveOptions(this.swigCPtr, OdDbRevolveOptions.getCPtr(revolveOptions));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setRevolveOptions(OdDbRevolveOptions revolveOptions)
		{
			TD_DbPINVOKE.OdDbRevolvedSurface_setRevolveOptions(this.swigCPtr, OdDbRevolveOptions.getCPtr(revolveOptions));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void setRevolve(OdGePoint3d axisPnt, OdGeVector3d axisVec, double revAngle, OdDbRevolveOptions revolveOptions)
		{
			TD_DbPINVOKE.OdDbRevolvedSurface_setRevolve(this.swigCPtr, OdGePoint3d.getCPtr(axisPnt), OdGeVector3d.getCPtr(axisVec), revAngle, OdDbRevolveOptions.getCPtr(revolveOptions));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult subTransformBy(OdGeMatrix3d xfm)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRevolvedSurface_subTransformBy(this.swigCPtr, OdGeMatrix3d.getCPtr(xfm));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdResult dwgInFields(OdDbDwgFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRevolvedSurface_dwgInFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dwgOutFields(OdDbDwgFiler pFiler)
		{
			TD_DbPINVOKE.OdDbRevolvedSurface_dwgOutFields(this.swigCPtr, OdDbDwgFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult dxfInFields(OdDbDxfFiler pFiler)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRevolvedSurface_dxfInFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void dxfOutFields(OdDbDxfFiler pFiler)
		{
			TD_DbPINVOKE.OdDbRevolvedSurface_dxfOutFields(this.swigCPtr, OdDbDxfFiler.getCPtr(pFiler));
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public new virtual OdResult subGetClassID(IntPtr pClsid)
		{
			OdResult result = (OdResult)TD_DbPINVOKE.OdDbRevolvedSurface_subGetClassID(this.swigCPtr, pClsid);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool isDependent()
		{
			bool result = TD_DbPINVOKE.OdDbRevolvedSurface_isDependent(this.swigCPtr);
			if (TD_DbPINVOKE.SWIGPendingException.Pending)
			{
				throw TD_DbPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
